package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MesChkbillCgzxT;
import com.ruoyi.system.service.IMesChkbillCgzxTService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 互检任务（城轨轴箱） 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-02-22
 */
@Controller
@RequestMapping("/system/mesChkbillCgzxT")
public class MesChkbillCgzxTController extends BaseController
{
    private String prefix = "system/mesChkbillCgzxT";
	
	@Autowired
	private IMesChkbillCgzxTService mesChkbillCgzxTService;
	
	@RequiresPermissions("system:mesChkbillCgzxT:view")
	@GetMapping()
	public String mesChkbillCgzxT()
	{
	    return prefix + "/mesChkbillCgzxT";
	}
	
	/**
	 * 查询互检任务（城轨轴箱）列表
	 */
	@RequiresPermissions("system:mesChkbillCgzxT:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(MesChkbillCgzxT mesChkbillCgzxT)
	{
		startPage();
        List<MesChkbillCgzxT> list = mesChkbillCgzxTService.selectMesChkbillCgzxTList(mesChkbillCgzxT);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出互检任务（城轨轴箱）列表
	 */
	@RequiresPermissions("system:mesChkbillCgzxT:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MesChkbillCgzxT mesChkbillCgzxT)
    {
    	List<MesChkbillCgzxT> list = mesChkbillCgzxTService.selectMesChkbillCgzxTList(mesChkbillCgzxT);
        ExcelUtil<MesChkbillCgzxT> util = new ExcelUtil<MesChkbillCgzxT>(MesChkbillCgzxT.class);
        return util.exportExcel(list, "mesChkbillCgzxT");
    }
	
	/**
	 * 新增互检任务（城轨轴箱）
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存互检任务（城轨轴箱）
	 */
	@RequiresPermissions("system:mesChkbillCgzxT:add")
	@Log(title = "互检任务（城轨轴箱）", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(MesChkbillCgzxT mesChkbillCgzxT)
	{		
		return toAjax(mesChkbillCgzxTService.insertMesChkbillCgzxT(mesChkbillCgzxT));
	}

	/**
	 * 修改互检任务（城轨轴箱）
	 */
	@GetMapping("/edit/{gid}")
	public String edit(@PathVariable("gid") String gid, ModelMap mmap)
	{
		MesChkbillCgzxT mesChkbillCgzxT = mesChkbillCgzxTService.selectMesChkbillCgzxTById(gid);
		mmap.put("mesChkbillCgzxT", mesChkbillCgzxT);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存互检任务（城轨轴箱）
	 */
	@RequiresPermissions("system:mesChkbillCgzxT:edit")
	@Log(title = "互检任务（城轨轴箱）", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(MesChkbillCgzxT mesChkbillCgzxT)
	{		
		return toAjax(mesChkbillCgzxTService.updateMesChkbillCgzxT(mesChkbillCgzxT));
	}
	
	/**
	 * 删除互检任务（城轨轴箱）
	 */
	@RequiresPermissions("system:mesChkbillCgzxT:remove")
	@Log(title = "互检任务（城轨轴箱）", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(mesChkbillCgzxTService.deleteMesChkbillCgzxTByIds(ids));
	}
	
}
